<?php
abstract class obj
{
    protected $errors = array();

    public function set_error($error)
    {
        $this->errors[] = $error;
    }

    public function get_errors()
    {
        return $this->errors;
    }

    public function get_error()
    {
        if (count($this->errors)) return $this->errors[0];
        return null;
    }
    
    public function has_error()
    {
        return count($this->errors)>0;
    }
}